<?php

$unitPath = '-0-1-5-8-';
$unit = explode('-', rtrim($unitPath, '-'));
$lastUnit = array_pop($unit);
print_r($lastUnit);
